// 引入请求
import { request, requestMock } from "@/utils/http";
// 请求首页的三级分页列表
export const requestCategoryList = () => {
  return request.get('/api/product/getBaseCategoryList')
}
// 搜索post请求
export const requestSearchList = (params) => {
  return request.post('/api/list', params)
}
//请求banner数据
export const requestBannerList = () => {
  return requestMock.get("/banner")
};
//请求floor数据
export const requestFloorList = () => {
  return requestMock.get("/floor")
};
// 请求detail数据
export const requestDetail = (skuId) => {
  return request.get(`/api/item/${skuId}`)
}
// 添加到购物车
export const requestAddShopCar = ({ skuId, skuNum }) => {
  return request.post(`/api/cart/addToCart/${skuId}/${skuNum}`)
}
// 请求购物车数据
export const requestShopCarList = () => {
  return request.get("/api/cart/cartList")
}
// 切换商品选中状态
export const requestChangeCarList = ({ skuId, isChecked }) => {
  return request.get(`/api/cart/checkCart/${skuId}/${isChecked}`)
}
// 修改所有商品的选中状态
export const requestChangeAllCarState = (isChecked, skuIdList) => {
  return request.post(`/api/cart/batchCheckCart/${isChecked}`, skuIdList)
}
// 删除单个商品
export const requestDeleteCom = (skuId) => {
  return request.delete(`/api/cart/deleteCart/${skuId}`)
}
// 删除所有选中的商品
export const requestDeleteAllSelectCom = (skuIdList) => {
  return request.delete(`/api/cart/batchDeleteCart`, {
    data: skuIdList
  })
}
// 获取用户验证码
export const requestUserCodeList = (phone) => {
  return request.get(`/api/user/passport/sendCode/${phone}`)
}
// 注册请求
export const requestUserVerificationCode = (registerInfo) => {
  return request.post(`/api/user/passport/register`, registerInfo)
}
// 登录请求
export const requestLoginIn = (userInfo) => {
  return request.post("/api/user/passport/login", userInfo)
}
// 获取用户名
export const requestUsername = () => {
  return request.get('/api/user/passport/auth/getUserInfo')
}
// 退出登录
export const requestLoginOut = () => {
  return request.get('/api/user/passport/logout')
}
// 请求用户商品信息
export const requestTradeInventory = () => {
  return request.get('/api/order/auth/trade')
}
// 获取用户地址 mock数据
export const requestUserAddress = () => {
  return requestMock.get('/address')
}
// 提交订单的请求
export const requestReferOrder = (tradeNo, tradeInfo) => {
  return request.post(`/api/order/auth/submitOrder?tradeNo=${tradeNo}`, tradeInfo)
}
//根据订单号获取订单详细信息
export const requestPayDetail = (orderId) => {
  return request.get(`/api/payment/weixin/createNative/${orderId}`)
}
// 查询支付订单的状态
export const requestOrderState = (orderId) => {
  return request.get(`/api/payment/weixin/queryPayStatus/${orderId}`)
}
// 获取订单的数据
export const requestOrderList = ({ page, limit }) => {
  return request.get(`/api/order/auth/${page}/${limit}`)
}